package com.itheima.mapper;

import com.github.pagehelper.Page;
import com.itheima.pojo.AdminOder;
import com.itheima.pojo.AdminOderQueryParam;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface AdminOderMapper {
    /**
     * 查询所有订单
     * @return
     */
    @Select("select * from admin_order ")
    List<AdminOder> list();

    /**
     * 根据id查询订单
     * @return
     */
    @Select("select * from admin_order where id=#{id}")
    AdminOder getById();

    /**
     * 更新订单信息
     * @param adminOder
     */

    void update(AdminOder adminOder);

    /**
     * 分页查询
     * @param param
     * @return
     */
    Page<AdminOder> page(AdminOderQueryParam param);

@Delete("delete from admin_order where id=#{id}")
    void deleteById(Integer id);

    /**
     * 添加
     * @param adminOder
     */
    @Insert("insert into admin_order(id, trading_order_no, status, amount, member_id, phone, pet_id, branch_id, image, get_pet_time, create_time, update_time, create_by, update_by) VALUES(#{id}," +
        "#{tradingOrderNo},#{status},#{amount},#{memberId},#{phone},#{petId},#{branchId},#{image},#{getPetTime},#{createTime},#{updateTime},#{createBy},#{updateBy}) ")
    void add(AdminOder adminOder);

}
